package com.woniuxy.project115.kaer.user.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.project115.kaer.commons.util.Result;
import com.woniuxy.project115.kaer.user.form.AddVehicleForm;
import com.woniuxy.project115.kaer.user.param.AddVehicleParam;
import com.woniuxy.project115.kaer.user.service.UserVehicleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 车辆表 前端控制器
 * </p>
 *
 * @author fyy
 * @since 2025年02月17日
 */
@RestController
@RequestMapping("/userVehicle")
@Api(tags = "用户车辆接口")
public class UserVehicleController {
    @Resource
    private UserVehicleService userService;

    //用户新增车辆接口
    @PostMapping("/addUserVehicle")
    @ApiOperation("用户新增车辆接口")
    public Result addUserVehicle(@RequestBody AddVehicleForm form)throws Exception {
        userService.addUserVehicle(BeanUtil.toBean(form, AddVehicleParam.class));
        return Result.succeed("用户新增车辆成功",null);
    }
}

